{% extends 'layouts/master-page' %}
{% block title %}CAPEC browsing{% endblock %}
{% block content %}
<table class="table">
  <tbody>
  <tr>
    <td class="warning">Name</td>
    <td class="info"><b>{{capec.name}}</b></td>
  </tr>
  <tr>
    <td class="warning"></td>
    <td class="info">
      <table class="table table-striped">
        <tr  class="Warning">
          <td><b>Likelyhood of attack</b></td>
          <td class="capec_table_description"><b>Typical severity</b></td>
        </tr>
         <tr>
          <td class="typical_severity {% if capec.local == "Very High" %}critical{% elif capec.local == "Very Low" %}
           very_low{% else %} {{capec.loa}} {% endif %}">{{capec.loa}}</td>
          <td class="capec_table_description typical_severity {% if capec.typical_severity == "Very High" %}critical{% elif capec.typical_severity == "Very Low" %}
           very_low{% else %} {{capec.typical_severity}} {% endif %}">{{ capec.typical_severity }}</td>
        </tr>
      </table>
  </tr>
  <tr>
    <td class="warning">Summary</td>
    <td class="info">{{capec.summary}}</td>
  </tr>
  <tr>
    <td class="warning">Prerequisites</td>
    <td class="info">{{capec.prerequisites}}</td>
  </tr>
  {% if capec.execution_flow %}
  <tr>
    <td class="warning">Execution Flow </td>
    <td class="info">
      <table class="table table-striped">
        <tr  class="Warning">
          <td><b>Step</b></td>
          <td class="capec_table_description"><b>Phase</b></td>
          <td class="capec_table_description"><b>Description</b></td>
          <td class="capec_table_description"><b>Techniques</b></td>
        </tr>
        {% for entry in capec.execution_flow %}
        <tr>
          <td width="5%">{{ entry }}</td>
          <td width="5%" class="capec_table_description">{{ capec["execution_flow"][entry]["Phase"] }}</td>
          <td width="45%" class="capec_table_description">{{ capec["execution_flow"][entry]["Description"] }}</td>
          <td width="45%" class="capec_table_description">
            <ul>
              {% for each in capec["execution_flow"][entry]["Techniques"] %}
              <li>{{ each }}</li>
              {% endfor %}
            </ul>
          </td>
        </tr>
        {% endfor %}
      </table>
    </td>
  </tr>
  {% endif %}
  <tr> <td class="warning">Solutions         </td><td class="info">{{capec.solutions}}    </td> </tr>
  {% if capec.related_weakness|length != 0 %}
  <tr> <td class="warning">Related Weaknesses</td>
    <td class="info">
      <table class="table table-striped">
        <tr  class="Warning"> <td><b>CWE ID</b></td> <td class="capec_table_description"><b>Description</b></td> </tr>
        {% for c in capec.related_weakness|sortIntLikeStr %}
        <tr>
          <td width="75px"><a href="/cwe/{{c}}">CWE-{{c}}</a></td>
          <td class="capec_table_description">{{cwes[c]}}</td>
        </tr>
        {% endfor %}
      </table>
    </td>
  </tr>
  {% endif %}
  {% if capec.related_capecs|length != 0 %}
  <tr> <td class="warning">Related CAPECS</td>
    <td class="info">
      <table class="table table-striped">
        <tr class="Warning capec_discription_tr"> <td><b>CAPEC ID</b></td> <td class="capec_table_description"><b>Description</b></td> </tr>
        {% for c in capec.related_capecs|sortIntLikeStr %}
        <tr>
          <td width="75px"><a href="/capec/{{c}}">CAPEC-{{c}}</a></td>
          <td class="capec_table_description capec_discription_tr">{{capecs[c]}}</td>
        </tr>
        {% endfor %}
      </table>
    </td>
  </tr>
  {% endif %}
  {% if capec.taxonomy|length != 0 %}
  {% for each in capec.taxonomy %}
  <tr> <td class="warning">Taxonomy: {{ each }}</td>
    <td class="info">
      <table class="table table-striped">
        <tr class="Warning">
          <td><b>Entry ID</b></td>
          <td class="capec_table_description"><b>Entry Name</b></td>
        </tr>
        {% for item in capec["taxonomy"][each] %}
        <tr>
          <td class="capec_discription_tr" width="75px"><a href="{{ capec["taxonomy"][each][item]["URL"] }}">{{ capec["taxonomy"][each][item]["Entry_ID"] }}</a></td>
          <td class="capec_table_description capec_discription_tr">{{ capec["taxonomy"][each][item]["Entry_Name"] }}</td> </tr>
        {% endfor %}
      </table>
    </td>
  </tr>
  {% endfor %}
  {% endif %}
  </tbody>
</table>
{% endblock %}
